<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>七夕活动-留言</title>
    <script src="../Js/jquery-3.5.1.min.js" type="text/javascript"></script>
    <script src="../Js/Config.js" type="text/javascript"></script>
    <script src="../Js/Common.js" type="text/javascript"></script>

    <!--    页面样式    -->
    <link href="../Css/all.css" rel="stylesheet" type="text/css"/>

    <!--    弹窗插件    -->
    <script src="../Js/Msg/jquery.growl.js" type="text/javascript"></script>
    <link href="../Js/Msg/jquery.growl.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div style="margin-top: 50px">
    <a href="javascript:void(0)" class="logout">退出登录</a>
</div>
<div>点赞排行</div>

<table border="1px solid #cccccc" id="msgList">
    <tr>
        <td width="500">留言</td>
        <td width="100">作者</td>
        <td width="100">留言时间</td>
        <td width="100">点赞数</td>
    </tr>

</table>


<div style="margin-top: 100px">
    <a href="list.html">留言列表>>>>>>></a>
</div>

</body>
<script>
    $(function () {

        loadRankList();

        function loadRankList() {
            requestHost('msg/rank', {}, 'GET').then(function (res) {
                let str = ''
                for (let item of res.data) {
                    str += `<tr>
                                <td>${item.text}</td>
                                <td>${item.username}</td>
                                <td>${item.created_at}</td>
                                <td>${item.like_count}</td>
                            </tr>`
                }
                $("#msgList").append(str);
            })
        }

        $(".logout").click(function () {
            clearToken()
            window.location.href = 'login.html';
        })
    })
</script>
</html>